
string file = getenv("TMP1");
string DET = "dcTa";

void a(vector<TH1F *> &v, TObject *h){
  v.push_back((TH1F *)h);
} // end if

void nt(){
  TFile *f = new TFile(file.c_str(), "UPDATE");
  TTree *etf = (TTree *)f->Get("etf");
  vector<TH1F *> v;

  // --------------------- 13. Number of Tracks Per Event ----------------------- //
  etf->Draw("Length$(preTaTrackerX)>>h1(6, -0.5, 5.5)"); a(v,f->Get("h1"));
  etf->Draw("Length$(preTaTrackerY)>>h2(6, -0.5, 5.5)"); a(v,f->Get("h2"));
  etf->Draw("Length$(preTaTracker3D)>>h3(6, -0.5, 5.5)"); a(v,f->Get("h3"));
  etf->Draw("Length$(postTaTrackerX)>>h4(6, -0.5, 5.5)"); a(v,f->Get("h4"));
  etf->Draw("Length$(postTaTrackerY)>>h5(6, -0.5, 5.5)"); a(v,f->Get("h5"));
  etf->Draw("Length$(postTaTracker3D)>>h6(6, -0.5, 5.5)"); a(v,f->Get("h6"));

  TCanvas *c1 = new TCanvas("c", "Number of Tracks Per Event", 1680, 1050);
  c1->Divide(2, 3);
  for(int i = 0; i < 6; i++){
    c1->cd(i+1); v[i]->Draw();
  } // end for
  c1->Print("nt.pdf");
} // end vis
